home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / VARYFILE.MOD < prev    next >
Text File  |  1989-01-18  |  988b  |  38 lines

  1.                                          (* Chapter 8 - Program 4 *)
  2. MODULE VaryFile;
  3.  
  4. FROM FileSystem IMPORT Lookup, Close, File, Response, ReadChar;
  5. FROM InOut      IMPORT Write, WriteString, ReadString, WriteLn;
  6.  
  7. VAR  NameOfFile : ARRAY[1..15] OF CHAR;
  8.      InFile     : File;
  9.      Character  : CHAR;
  10.  
  11. BEGIN
  12.    REPEAT                  (* repeat until a good filename is found *)
  13.       WriteLn;
  14.       WriteString("Enter name of file to display ---> ");
  15.       ReadString(NameOfFile);
  16.       Lookup(InFile,NameOfFile,FALSE);
  17.    UNTIL InFile.res = done;                  (* good filename found *)
  18.  
  19.    REPEAT       (* character read/display loop - quit at InFile.eof *)
  20.       ReadChar(InFile,Character);
  21.       IF NOT InFile.eof THEN
  22.          Write(Character);
  23.       END;
  24.    UNTIL InFile.eof;                      (* quit when eof is found *)
  25.    Close(InFile);
  26.  
  27. END VaryFile.
  28.  
  29.  
  30.  
  31.  
  32. (* Result of execution
  33.  
  34. (The selected file is listed on the monitor.)
  35.  
  36. *)
  37.  
  38.